-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add Copy on write whatsnew #50470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.. code-block:: python | ||
|
||
with pd.option_context("mode.copy_on_write", True): | ||
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a small example that shows the effect of copy on write?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Sure, would be good to link to your article to learn more. |
Can you link to the other PR you mention in the description please? I'm missing the context. Ok by me to add a link from the what's new to the blog post. |
Thanks, added the initial pr that implemented it and added a link to the blog post. Happy to remove it, if any objections though. |
Thanks @phofl |
…50546) Backport PR #50470: DOC: Add Copy on write whatsnew Co-authored-by: Patrick Hoefler <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phofl thanks for adding this to the whatsnew! (it was for too long on my to do list ..)
Alternatively, copy on write can be enabled locally through: | ||
|
||
.. code-block:: python | ||
|
||
with pd.option_context("mode.copy_on_write", True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure we should encourage this usage by explicitly mentioning it (it's a general option, so if you are familiar with the option function, you can always use it this way using the existing option_context
).
This is tricky as this will only work if the data you are using it created within that block. Once you only put this around an operation, with data created before the block, things might go sideways.
(that's probably a limitation of the setting the option that we should document anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep it for now, since support on the 1.5.x branch is limited. It's more or less just to try it out. But agree we should maybe document this more clearly.
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.cc @mroeschke
As discussed in the other pr. This is for 1.5, will add another pr for the lazy copy methods.
Do you think it makes sense linking https://phofl.github.io/cow-introduction.html instead of explaining everything in here?